home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / GNU_KIT / DISK7.ZIP / gnu / man / man1 / find.1 < prev    next >
Encoding:
Text File  |  1991-11-12  |  14.7 KB  |  595 lines

  1.  
  2.  
  3.  
  4. FIND(1L)                                                 FIND(1L)
  5.  
  6.  
  7.  
  8. NAME
  9.      find - search for files in a directory hierarchy
  10.  
  11. SYNOPSIS
  12.      find [path...] [expression]
  13.  
  14. DESCRIPTION
  15.      This manual page documents the GNU version of find.  find
  16.      searches the directory tree rooted at each given pathname by
  17.      evaluating the given expression from left to right, accord-
  18.      ing to the rules of precedence (see section OPERATORS),
  19.      until the outcome is known (left hand side false for _a_n_d
  20.      operations, true for _o_r), at which point find moves on to
  21.      the next pathname.
  22.  
  23.      The first argument that begins with `-', `(', `)', `,', or
  24.      `!' is taken to be the beginning of the expression; any
  25.      arguments before it are paths to search, and any arguments
  26.      after it are the rest of the expression.  If no paths are
  27.      given, the current directory is used.  If no expression is
  28.      given, the expression `-print' is used.
  29.  
  30.      find exits with status 0 if all files are processed success-
  31.      fully, greater than 0 if errors occur.
  32.  
  33. EXPRESSIONS
  34.      The expression is made up of options (which affect overall
  35.      operation rather than the processing of a specific file, and
  36.      always return true), tests (which return a true or false
  37.      value), and actions (which have side effects and return a
  38.      true or false value), all separated by operators.  -and is
  39.      assumed where the operator is omitted.  If the expression
  40.      contains no actions other than -prune, -print is performed
  41.      on all files for which the expression is true.
  42.  
  43.      OPTIONS
  44.  
  45.      -daystart
  46.           Measure times (for -amin, -atime, -cmin, -ctime, -mmin,
  47.           and -mtime) from the beginning of today rather than
  48.           from 24 hours ago.
  49.  
  50.      -depth
  51.           Process each directory's contents before the directory
  52.           itself.
  53.  
  54.      -follow
  55.           Dereference symbolic links.
  56.  
  57.      -maxdepth _l_e_v_e_l_s
  58.           Descend at most _l_e_v_e_l_s (a non-negative integer) levels
  59.           of directories below the command line arguments.
  60.  
  61.  
  62.  
  63. Page 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FIND(1L)                                                 FIND(1L)
  71.  
  72.  
  73.  
  74.           `-maxdepth 0' means only apply the tests and actions to
  75.           the command line arguments.
  76.  
  77.      -mindepth _l_e_v_e_l_s
  78.           Do not apply any tests or actions at levels less than
  79.           _l_e_v_e_l_s (a non-negative integer).  `-mindepth 1' means
  80.           process all files except the command line arguments.
  81.  
  82.      -version
  83.           True; print find version number on standard error.
  84.  
  85.      -xdev
  86.           True; don't descend directories on other filesystems.
  87.  
  88.      TESTS
  89.  
  90.      Numeric arguments can be specified as
  91.  
  92.      +_n   for greater than _n,
  93.  
  94.      -_n   for less than _n,
  95.  
  96.      _n    for exactly _n.
  97.  
  98.      -amin _n
  99.           File was last accessed _n minutes ago.
  100.  
  101.      -anewer _f_i_l_e
  102.           File was last accessed more recently than _f_i_l_e was
  103.           modified.  -anewer is affected by -follow only if -fol-
  104.           low comes before -anewer on the command line.
  105.  
  106.      -atime _n
  107.           File was last accessed _n*24 hours ago.
  108.  
  109.      -cmin _n
  110.           File's status was last changed _n minutes ago.
  111.  
  112.      -cnewer _f_i_l_e
  113.           File's status was last changed more recently than _f_i_l_e
  114.           was modified.  -cnewer is affected by -follow only if
  115.           -follow comes before -cnewer on the command line.
  116.  
  117.      -ctime _n
  118.           File's status was last changed _n*24 hours ago.
  119.  
  120.      -empty
  121.           File is empty and is either a regular file or a direc-
  122.           tory.
  123.  
  124.      -false
  125.           Always false.
  126.  
  127.  
  128.  
  129. Page 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FIND(1L)                                                 FIND(1L)
  137.  
  138.  
  139.  
  140.      -fstype _t_y_p_e
  141.           File is on a filesystem of type _t_y_p_e.  The valid
  142.           filesystem types vary among different versions of Unix;
  143.           an incomplete list of filesystem types that are
  144.           accepted on some version of Unix or another is: ufs,
  145.           4.2, 4.3, nfs, tmp, mfs, S51K, S52K.
  146.  
  147.      -gid _n
  148.           File's numeric group ID is _n.
  149.  
  150.      -group _g_n_a_m_e
  151.           File belongs to group _g_n_a_m_e (numeric group ID allowed).
  152.  
  153.      -inum _n
  154.           File has inode number _n.
  155.  
  156.      -links _n
  157.           File has _n links.
  158.  
  159.      -lname _p_a_t_t_e_r_n
  160.           File is a symbolic link whose contents match shell pat-
  161.           tern _p_a_t_t_e_r_n.  `*' and `?' match `.' at the start of
  162.           the link contents.  Slash characters have no special
  163.           meaning in the comparison.
  164.  
  165.      -mmin _n
  166.           File's data was last modified _n minutes ago.
  167.  
  168.      -mtime _n
  169.           File's data was last modified _n*24 hours ago.
  170.  
  171.      -name _p_a_t_t_e_r_n
  172.           Base of path name (the path with the leading direc-
  173.           tories removed) matches shell pattern _p_a_t_t_e_r_n.  `*' and
  174.           `?' do not match `.' at the start of the filename.
  175.  
  176.      -newer _f_i_l_e
  177.           File was modified more recently than _f_i_l_e.  -newer is
  178.           affected by -follow only if -follow comes before -newer
  179.           on the command line.
  180.  
  181.      -nouser
  182.           No user corresponds to file's numeric user ID.
  183.  
  184.      -nogroup
  185.           No group corresponds to file's numeric group ID.
  186.  
  187.      -perm _m_o_d_e
  188.           File's permission bits are exactly _m_o_d_e (octal or sym-
  189.           bolic).
  190.  
  191.      -perm -_m_o_d_e
  192.  
  193.  
  194.  
  195. Page 3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FIND(1L)                                                 FIND(1L)
  203.  
  204.  
  205.  
  206.           Permission bits _m_o_d_e are set for the file.
  207.  
  208.      -regex _p_a_t_t_e_r_n
  209.           Pathname matches regular expression _p_a_t_t_e_r_n.
  210.  
  211.      -size _n[ck]
  212.           File uses _n 512-byte blocks (bytes if `c' follows _n,
  213.           kilobytes if `k' follows _n).  The size does not count
  214.           indirect blocks, and does count blocks in sparse files
  215.           that are not actually allocated.
  216.  
  217.      -true
  218.           Always true.
  219.  
  220.      -type _c
  221.           File is of type _c:
  222.  
  223.           b    block (buffered) character
  224.  
  225.           c    character (unbuffered) character
  226.  
  227.           d    directory
  228.  
  229.           p    named pipe (FIFO)
  230.  
  231.           f    regular file
  232.  
  233.           l    symbolic link
  234.  
  235.           s    socket
  236.  
  237.      -uid _n
  238.           File's numeric user ID is _n.
  239.  
  240.      -used _n
  241.           File was last accessed _n days after its status was last
  242.           changed.
  243.  
  244.      -user _u_n_a_m_e
  245.           File is owned by user _u_n_a_m_e (numeric user ID allowed).
  246.  
  247.      -xtype _c
  248.           The same as -type unless the file is a symbolic link.
  249.           For symbolic links, if -follow has not been given, true
  250.           if the file is a link to a file of type _c; if -follow
  251.           has been given, true if _c is `l'.  For symbolic links,
  252.           -xtype checks the type of the file that -type does not
  253.           check.
  254.  
  255.      ACTIONS
  256.  
  257.      -exec _c_o_m_m_a_n_d ;
  258.  
  259.  
  260.  
  261. Page 4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FIND(1L)                                                 FIND(1L)
  269.  
  270.  
  271.  
  272.           Execute _c_o_m_m_a_n_d; true if 0 status is returned.  All
  273.           following arguments to find are taken to be arguments
  274.           to the command until an argument consisting of `;' is
  275.           encountered.  The string `{}' is replaced by the
  276.           current pathname being processed everywhere it occurs
  277.           in the arguments to the command.  Both of these con-
  278.           structions might need to be escaped (with a `\') or
  279.           quoted to protect them from expansion by the shell.
  280.  
  281.      -fprint _f_i_l_e
  282.           True; print the full pathname into file _f_i_l_e.  If _f_i_l_e
  283.           does not exist when find is run, it is created; if it
  284.           does exist, it is truncated.  The filenames
  285.           ``/dev/stdout'' and ``/dev/stderr'' are handled spe-
  286.           cially; they refer to the standard output and standard
  287.           error output, respectively.
  288.  
  289.      -fprint0 _f_i_l_e
  290.           True; like -print0 but write to _f_i_l_e like -fprint.
  291.  
  292.      -fprintf _f_i_l_e _f_o_r_m_a_t
  293.           True; like -printf but write to _f_i_l_e like -fprint.
  294.  
  295.      -ok _c_o_m_m_a_n_d ;
  296.           Like -exec but ask user first; if the response does not
  297.           start with `y' or `Y', do not run the command, and
  298.           return false.
  299.  
  300.      -print
  301.           True; print the full pathname on the standard output,
  302.           followed by a newline.
  303.  
  304.      -print0
  305.           True; print the full pathname on the standard output,
  306.           followed by a null character.  This allows filenames
  307.           that contain newlines to be correctly interpreted by
  308.           programs that process the find output.
  309.  
  310.      -printf _f_o_r_m_a_t
  311.           True; print _f_o_r_m_a_t on the standard output, interpreting
  312.           `\' escapes and `%' directives.  Field widths and pre-
  313.           cisions can be specified as with the `printf' C func-
  314.           tion.  The escapes and directives are:
  315.  
  316.           \a   Alarm bell.
  317.  
  318.           \b   Backspace.
  319.  
  320.           \c   Stop printing from this format immediately.
  321.  
  322.           \f   Form feed.
  323.  
  324.  
  325.  
  326.  
  327. Page 5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FIND(1L)                                                 FIND(1L)
  335.  
  336.  
  337.  
  338.           \n   Newline.
  339.  
  340.           \r   Carriage return.
  341.  
  342.           \t   Horizontal tab.
  343.  
  344.           \v   Vertical tab.
  345.  
  346.           A `\' character followed by any other character is
  347.           treated as an ordinary character, so they both are
  348.           printed.
  349.  
  350.           %%   A literal percent sign.
  351.  
  352.           %a   File's last access time in the format returned by
  353.                the C `ctime' function.
  354.  
  355.           %A_k  File's last access time in the format specified by
  356.                _k, which is either `@' or a directive for the C
  357.                `strftime' function.  The possible values for _k
  358.                are listed below; some of them might not be avail-
  359.                able on all systems, due to differences in
  360.                `strftime' between systems.
  361.  
  362.                @    seconds since Jan. 1, 1970, 00:00 GMT.
  363.  
  364.                Time fields:
  365.  
  366.                H    hour (00..23)
  367.  
  368.                I    hour (00..12)
  369.  
  370.                M    minute (00..59)
  371.  
  372.                p    locale's AM or PM
  373.  
  374.                r    time, 12-hour (hh:mm:ss [AP]M)
  375.  
  376.                S    second (00..61)
  377.  
  378.                T    time, 24-hour (hh:mm:ss)
  379.  
  380.                X    locale's time representation (H:M:S)
  381.  
  382.                Z    time zone (e.g., EDT), or nothing if no time
  383.                     zone is determinable
  384.  
  385.                Date fields:
  386.  
  387.                a    locale's abbreviated weekday name (Sun..Sat)
  388.  
  389.                A    locale's full weekday name, variable length
  390.  
  391.  
  392.  
  393. Page 6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. FIND(1L)                                                 FIND(1L)
  401.  
  402.  
  403.  
  404.                     (Sunday..Saturday)
  405.  
  406.                b    locale's abbreviated month name (Jan..Dec)
  407.  
  408.                B    locale's full month name, variable length
  409.                     (January..December)
  410.  
  411.                c    locale's date and time (Sat Nov 04 12:02:33
  412.                     EST 1989)
  413.  
  414.                d    day of month (01..31)
  415.  
  416.                D    date (mm/dd/yy)
  417.  
  418.                h    same as b
  419.  
  420.                j    day of year (001..366)
  421.  
  422.                m    month (01..12)
  423.  
  424.                U    week number of year with Sunday as first day
  425.                     of week (00..53)
  426.  
  427.                w    day of week (0..6)
  428.  
  429.                W    week number of year with Monday as first day
  430.                     of week (00..53)
  431.  
  432.                x    locale's date representation (mm/dd/yy)
  433.  
  434.                y    last two digits of year (00..99)
  435.  
  436.                Y    year (1970...)
  437.  
  438.           %b   File's size in 512-byte blocks (rounded up).
  439.  
  440.           %c   File's last status change time in the format
  441.                returned by the C `ctime' function.
  442.  
  443.           %C_k  File's last status change time in the format
  444.                specified by _k, which is the same as for %A.
  445.  
  446.           %d   File's depth in the directory tree; 0 means the
  447.                file is a command line argument.
  448.  
  449.           %f   File's pathname with any leading directories
  450.                removed.
  451.  
  452.           %g   File's group name, or numeric group ID if the
  453.                group has no name.
  454.  
  455.           %G   File's numeric group ID.
  456.  
  457.  
  458.  
  459. Page 7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. FIND(1L)                                                 FIND(1L)
  467.  
  468.  
  469.  
  470.           %h   Leading directories of file's pathname.
  471.  
  472.           %H   Command line argument under which file was found.
  473.  
  474.           %i   File's inode number (in decimal).
  475.  
  476.           %k   File's size in 1K blocks (rounded up).
  477.  
  478.           %l   Object of symbolic link (empty string if file is
  479.                not a symbolic link).
  480.  
  481.           %m   File's permission bits (in octal).
  482.  
  483.           %n   Number of hard links to file.
  484.  
  485.           %p   File's pathname.
  486.  
  487.           %P   File's pathname with the name of the command line
  488.                argument under which it was found removed.
  489.  
  490.           %s   File's size in bytes.
  491.  
  492.           %t   File's last modification time in the format
  493.                returned by the C `ctime' function.
  494.  
  495.           %T_k  File's last modification time in the format speci-
  496.                fied by _k, which is the same as for %A.
  497.  
  498.           %u   File's user name, or numeric user ID if the user
  499.                has no name.
  500.  
  501.           %U   File's numeric user ID.
  502.  
  503.           A `%' character followed by any other character is dis-
  504.           carded (but the other character is printed).
  505.  
  506.      -prune
  507.           If -depth is not given, true; do not descend the
  508.           current directory.
  509.           If -depth is given, false; no effect.
  510.  
  511.      -ls  True; list current file in `ls -dils' format on stan-
  512.           dard output.  The block counts are of 1K blocks, unless
  513.           the environment variable POSIX_ME_HARDER is set, in
  514.           which case 512-byte blocks are used.
  515.  
  516.      OPERATORS
  517.  
  518.      Listed in order of decreasing precendence:
  519.  
  520.      ( _e_x_p_r )
  521.           Force precedence.
  522.  
  523.  
  524.  
  525. Page 8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. FIND(1L)                                                 FIND(1L)
  533.  
  534.  
  535.  
  536.      ! _e_x_p_r
  537.           True if _e_x_p_r is false.
  538.  
  539.      -not _e_x_p_r
  540.           Same as ! _e_x_p_r.
  541.  
  542.      _e_x_p_r_1 _e_x_p_r_2
  543.           And (implied); _e_x_p_r_2 is not evaluated if _e_x_p_r_1 is
  544.           false.
  545.  
  546.      _e_x_p_r_1 -a _e_x_p_r_2
  547.           Same as _e_x_p_r_1 _e_x_p_r_2.
  548.  
  549.      _e_x_p_r_1 -and _e_x_p_r_2
  550.           Same as _e_x_p_r_1 _e_x_p_r_2.
  551.  
  552.      _e_x_p_r_1 -o _e_x_p_r_2
  553.           Or; _e_x_p_r_2 is not evaluated if _e_x_p_r_1 is true.
  554.  
  555.      _e_x_p_r_1 -or _e_x_p_r_2
  556.           Same as _e_x_p_r_1 -o _e_x_p_r_2.
  557.  
  558.      _e_x_p_r_1 , _e_x_p_r_2
  559.           List; both _e_x_p_r_1 and _e_x_p_r_2 are always evaluated.  The
  560.           value of _e_x_p_r_1 is discarded; the value of the list is
  561.           the value of _e_x_p_r_1.
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591. Page 9
  592.  
  593.  
  594.  
  595.